package com.aabte.auth.shared.model;

import lombok.Getter;
import lombok.ToString;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.MappedSuperclass;
import java.time.Instant;

@MappedSuperclass
@Getter
@ToString
public abstract class BaseModel {

    public static final String FIELD_NAME_CREATE_ON = "createOn";
    public static final String FIELD_NAME_CREATOR = "creator";
    public static final String FIELD_NAME_UPDATE_ON = "updateOn";
    public static final String FIELD_NAME_UPDATER = "updater";

    @CreatedDate
    private Instant createOn;

    @CreatedBy
    private String creator;

    @LastModifiedDate
    private Instant updateOn;

    @LastModifiedBy
    private String updater;

}
